home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mntlb20 / lib / sscanf.c < prev    next >
C/C++ Source or Header  |  1991-11-22  |  548b  |  38 lines

  1. #define __SRC__
  2. #include <stdio.h>
  3. #include "lib.h"
  4.  
  5. static int sgetc(s)
  6.     unsigned char **s;
  7. {
  8.     register unsigned char c;
  9.  
  10.     c = *(*s)++;
  11.     return((c == '\0') ? EOF : c);
  12. }
  13.  
  14. static int sungetc(c, s)
  15.     int c;
  16.     unsigned char **s;
  17. {
  18.     if(c == EOF)
  19.         c = '\0';
  20.     return(*--(*s) = c);
  21. }
  22.  
  23. int
  24. sscanf(buf, fmt, arg)
  25.     const char *buf, *fmt;
  26.     int arg;
  27. {
  28.     return(_scanf(&buf, sgetc, sungetc, fmt, &arg));
  29. }
  30.  
  31. int
  32. vsscanf(buf, fmt, arg)
  33.     const char *buf, *fmt;
  34.     char *arg;
  35.     {
  36.     return(_scanf(&buf, sgetc, sungetc, fmt, arg));
  37.     }
  38.